package com.romotc.qqrobot.bean.json;

import java.io.IOException;
import java.util.Map;

import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;

/**
 * QQ接口接口返回数据
 * @author Administrator
 *
 */
public class QQInterfaceData {

	private int retcode;
	private Map result;
	private String errmsg;
	private String p;
	
	
	public int getRetcode() {
		return retcode;
	}


	public void setRetcode(int retcode) {
		this.retcode = retcode;
	}


	public String getErrmsg() {
		return errmsg;
	}


	public void setErrmsg(String errmsg) {
		this.errmsg = errmsg;
	}


	public String getP() {
		return p;
	}


	public void setP(String p) {
		this.p = p;
	}


	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		 ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
		 String jsonString = "{\"retcode\":0,\"result\":{\"level\":34,\"days\":1336,\"hours\":8790,\"remainDays\":29,\"tuin\":4161888596}}";
		 try {
			 QQInterfaceData user = mapper.readValue(jsonString, QQInterfaceData.class);
			 System.out.println(user.getErrmsg());
			 System.out.println(user.getP());
			 System.out.println(user.getResult());
			 System.out.println(user.getRetcode());
		} catch (JsonParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (JsonMappingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}


	public Map getResult() {
		return result;
	}


	public void setResult(Map result) {
		this.result = result;
	}

}
